var xctps = new Array();//常用项类型id
	var xctpsid;	
$(function() {
	var rowNum = 1;


	$("#handdatagrid").datagrid({
		rownumbers: false,
		nowrap: false,
		border: true,
		border: true,
		width: $(window).width(),
		toolbar: '#xctpGridToolbar',
	})
	var handdatagridPanel = $("#handdatagrid").datagrid("getPanel");
	handdatagridPanel.on("click", "a.add", function() {
		$("#xctpdlgadd").dialog({
			buttons: [{
					text: "添加",
					iconCls: "icon-save",
					handler: function() {
						rowNum = rowNum + 1;
						var table = "<div><table class='form_table' id='xctpform_table2" + rowNum + "' >" +
							"<tr>" +
							"<td id='td_left' >" +
							"序号：" +
							"</td>" +
							"<td id='td_right'><input class='easyui-textbox'style='width:100%' readonly='readonly' value=" + rowNum + "></td>" +
							"<td  id='td_left'>" +
							"现场照片：" +
							"</td>" +
							"<td id='td_right'><input class='easyui-filebox' style='width:100%'  name='file' data-options=" + "buttonText:'选择',prompt:'请选择文件...'" + "  /></td>" +
							"</tr>" +
							"<tr>" +
							"<td id='td_left'>" +
							"现场照片类型:"+
							"</td>" +
							"<td>"+
							'<input type="radio" name="type'+rowNum+'"><label>方位</label>'+
							'<input type="radio" name="type'+rowNum+'"><label>概貌</label>'+
							'<input type="radio" name="type'+rowNum+'"><label>重点部位</label>'+
							'<input type="radio" name="type'+rowNum+'"><label>细目</label>'+
							'<input type="radio" name="type'+rowNum+'"><label>其它</label>'+
							
							"</td>"
							+
							"<td id='td_left'>" +
							"现场照片说明：" +
							"</td>" +
							"<td  ><input class='easyui-textbox' style='width:100%'   data-options='multiline:true' ></td>" +
							"</tr>" +

							"</table></div>"
						$("#xctpForm").append(table);
						$.parser.parse($("#xctpForm").parent());
					}
				}, {
					text: "删除",
					iconCls: "icon-remove",
					handler: function() {
						if(rowNum == 1) {
							return;
						}
						$("#xctpform_table2" + rowNum).remove();
						rowNum = rowNum - 1;
					}
				}, {
					text: "保存",
					iconCls: "icon-save",
					handler: function() {

					}
				}, {
					text: "取消",
					iconCls: "icon-cancel",
					handler: function() {
						$("#xctpdlgadd").dialog("close");
					}
				}

			]
		});
		$("#xctpdlgadd").dialog("open").dialog('setTitle', '现场图基本信息新增');
	}).on("click", "a.manypicture", function() {
		$("#xctpdlgpic").dialog({
			buttons: [{
				text: "添加",
				iconCls: "icon-save",
				handler: function() {

				}
			}, {
				text: "取消",
				iconCls: "icon-cancel",
				handler: function() {
					$("#xctpdlgpic").dialog("close");
				}
			}]
		});
		$("#xctpdlgpic").dialog("open").dialog('setTitle', '现场图图片上传');
	});

	

})

//多文件上传
$('#xctpf').filebox({
	onChange: function(value) {
		var f = $(this).next().find('input[type=file]')[0]; 
		if(f.files && f.files[0]) {
			// 更换图片时清空原图片展示内容
			      
			$('#xctpimage').html('');       
			for(var i = 0; i < f.files.length; i++) {        
				var reader = new FileReader(f.files[i]);        
				reader.onload = function(e) {
					//append为在元素中的末尾添加内容
					          
					$('#xctpimage').append("<img src='" + e.target.result + "' width='200px' height='100px'>");        
				}        
				reader.readAsDataURL(f.files[i]);
			}    
		}  
	}
})

$("#editHandInfo").click(function() {
	$("#handtableinfo").hide();
	$("#handtableinfo_edit").show();

})
$("#handedit_back").click(function() {
	$("#handtableinfo").show();
	$("#handtableinfo_edit").hide();
})

function dictselect(obj) {
   xctpsid=obj.id;
	$("#xctpdlg").dialog("open").dialog('setTitle', '现场图片类型字典');
}
